package org.iss.ip.controller;

import java.util.List;

import org.iss.ip.bean.Book;
import org.iss.ip.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("book")
public class BookController {

	@Autowired
	private BookService bookService;
	
	/**
	 * 提供网络接口，根据书名查找
	 * @param name
	 * @return
	 */
	@RequestMapping("findByName")
	public List<Book> findByName(String name) {
		return bookService.findByName(name);
	}
	
	/**
	 * 不对网页开放，后台操作，保存一本书
	 * @param book
	 */
	public void save(Book book) {
		bookService.save(book);
	}
	
	/**
	 * 保存多本书
	 * @param books
	 */
	public void save(List<Book> books) {
		bookService.save(books);
	}
}
